#!/usr/bin/python3
# -*- coding: UTF-8 -*-


# fi   = git@gitlab.netflying.net:netflying/054-thepupsocks.com.git
# fi_d = filepath = G:/www/wangxiang/
# f    = 054-thepupsocks.com
# c.hot_fix_name = 

import os
from gitlab_map import site_map
import config as c

def git_clone(filepath, git_flow_open):
    domain_list = c.dirname_list
    gitflow = c.gitflow_list
    domain = []
    for i in domain_list:
        for k in gitflow:
            if k == i:
                domain.append(k)
    domain = domain_list
    for i in domain:
        name = i.lower()
        fi = site_map[name]
        fi_d = filepath
        try:
            f = fi.split('/')[1][:-4]
            cmd = "cd /d %s\%s && git branch" % (fi_d, f)
            print("cmd=", cmd)
            os.system(cmd)
        except:
            print(fi + ' ***** 拉取失败 *****')

if __name__ == "__main__":
    batch_git_path = c.batch_git_path
    git_clone(batch_git_path, c.git_flow_check)
